package com.rem.se.test4;

public class Main {
    public static void main(String[] args) {
        // 创建两个测试用例，l1 = 987, l2 = 512
        Solution.ListNode n9 = new Solution.ListNode(9);
        Solution.ListNode n8 = new Solution.ListNode(8);
        Solution.ListNode n7 = new Solution.ListNode(7);
        n9.next = n8;
        n8.next = n7;

        Solution.ListNode n5 = new Solution.ListNode(5);
        Solution.ListNode n1 = new Solution.ListNode(1);
        Solution.ListNode n2 = new Solution.ListNode(2);
        n5.next = n1;
        n1.next = n2;

        // 调用 subtract 方法计算差值，并输出结果链表
        Solution s = new Solution();
        Solution.ListNode diff = s.subtract(n9, n5);
        while (diff != null) {
            System.out.print(diff.val + " ");
            diff = diff.next;
        }
    }
}
